<template>
  <div class="bb-bg">
    <div class="co-title">
      <div class="co-title-name">
        <img src="@/assets/cockpit/subdivision/gdbh-text-gdbh.png" alt="" />
      </div>
      <div class="co-title-right gdbh-title-right">
        <div class="co-title-select gdbh-selected">
          <el-select v-model="selectedValue" placeholder="请选择" :popper-append-to-body="false">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
          </el-select>
        </div>
        <div class="right-text">单位：公顷</div>
        <div class="co-title-breathe"><i></i><i></i><i></i><i></i><i></i><i></i></div>
      </div>
    </div>
    <div class="time-area">
      <span class="name-style">选择对比时间段：</span>
      <div class="co-title-select time-selected">
        <el-select v-model="startData" placeholder="请选择" :popper-append-to-body="false">
          <el-option v-for="item in timeOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
        </el-select>
      </div>
      <span class="mid-text-style">至</span>
      <div class="co-title-select time-selected">
        <el-select v-model="endData" placeholder="请选择" :popper-append-to-body="false">
          <el-option v-for="item in timeOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
        </el-select>
      </div>
    </div>

    <ul class="td-list2">
      <li>
        <div class="item">
          <img src="@/assets/cockpit/subdivision/wq-icon-1.png" alt="" />
          <div class="text-area">
            <p class="num num-style-1">+112.3</p>
          </div>
          <p class="name">水田</p>
        </div>
      </li>
      <li>
        <div class="item">
          <img src="@/assets/cockpit/subdivision/wq-icon-2.png" alt="" />
          <div class="text-area">
            <p class="num num-style-2">-42.7</p>
          </div>
          <p class="name">旱地</p>
        </div>
      </li>
      <li>
        <div class="item">
          <img src="@/assets/cockpit/subdivision/gdbh-gdbh-icon-3.png" alt="" />
          <div class="text-area">
            <p class="num num-style-1">+8.4</p>
          </div>
          <p class="name">水浇地</p>
        </div>
      </li>
      <li>
        <div class="item">
          <img src="@/assets/cockpit/subdivision/gdbh-gdbh-icon-4.png" alt="" />
          <div class="text-area">
            <p class="num num-style-2">-146.6</p>
          </div>
          <p class="name">总量</p>
        </div>
      </li>
    </ul>

    <div class="row-line"></div>
    <div class="bpl-container">
      <div class="lf">
        <p class="title">2021年度各县区市耕地面积情况</p>

        <div class="gdbh-total-statistics">
          <div>
            <div class="name-area">
              <div class="item">
                <div class="icon icon1"></div>
                <div class="text">补充</div>
              </div>
              <div class="item">
                <div class="icon icon2"></div>
                <div class="text">占用</div>
              </div>
            </div>
            <div class="pq-echart-box" id="gdbhEchart"></div>
          </div>
          <ul class="gdbh-total-area">
            <li>
              <p class="text">共占用</p>
              <p class="num">3.212</p>
            </li>
            <li>
              <p class="text">共补充</p>
              <p class="num">3.212</p>
            </li>
          </ul>
        </div>
      </div>
      <div class="col-line"></div>
      <div class="rg">
        <p class="title">补充来源</p>
        <ul class="list-area">
          <li class="item">
            <div class="icon"></div>
            <div class="text-area">
              <p class="text">土地开发</p>
              <p class="num">42.11</p>
            </div>
          </li>
          <li class="item">
            <div class="icon"></div>
            <div class="text-area">
              <p class="text">土地综合整治</p>
              <p class="num">42.11</p>
            </div>
          </li>
          <li class="item">
            <div class="icon"></div>
            <div class="text-area">
              <p class="text">增减挂钩</p>
              <p class="num">42.11</p>
            </div>
          </li>
          <li class="item">
            <div class="icon"></div>
            <div class="text-area">
              <p class="text">耕地复垦</p>
              <p class="num">42.11</p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import echarts from 'echarts'

@Component({
  name: 'LandProtectionItem2',
  components: {}
})
export default class LandProtectionItem2 extends Vue {
  private selectedValue = 1
  private options = [
    {
      value: 1,
      label: '全长沙市'
    }
  ]
  private startData = 2
  private endData = 1
  private timeOptions = [
    {
      value: 1,
      label: '2021年'
    },
    {
      value: 2,
      label: '2020年'
    }
  ]
  initVillage4() {
    const myChart = echarts.init(document.getElementById('gdbhEchart') as HTMLElement)
    myChart.setOption({
      label: {
        color: '#ffffff'
      },
      dataset: {
        source: [
          ['product', '2015', '2016'],
          ['湿地', 43.3, 85.8],
          ['草地', 83.1, 73.4],
          ['园地', 86.4, 65.2]
        ]
      },
      grid: {
        top: '1%',
        left: '0%',
        right: '4%',
        bottom: '3%',
        containLabel: true
      },
      xAxis: {
        type: 'category',
        //设置网格线颜色
        splitLine: {
          show: false
        },
        axisLine: {
          lineStyle: {
            color: '#254177'
          }
        },
        axisLabel: {
          show: true,
          // interval: 0,
          // rotate: 40,
          textStyle: {
            color: '#ffffff', //更改坐标轴文字颜色
            fontSize: 10 //更改坐标轴文字大小
          }
        }
      },
      yAxis: {
        type: 'value',
        axisLabel: {
          show: true,
          textStyle: {
            color: '#00eaff', //更改坐标轴文字颜色
            fontSize: 12 //更改坐标轴文字大小
          }
        },
        splitLine: {
          show: true,
          lineStyle: {
            color: ['#223e75'],
            width: 1,
            type: 'solid'
          }
        },
        // y轴轴线颜色
        axisLine: {
          lineStyle: {
            color: '#254177',
            width: 0 //这里是坐标轴的宽度
          }
        }
      },
      series: [
        {
          type: 'bar',
          barWidth: '25%',
          itemStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              {
                offset: 0,
                color: '#006AFF'
              },
              {
                offset: 0.5,
                color: '#006AFF'
              },
              {
                offset: 1,
                color: '#006AFF'
              }
            ])
          },
          showBackground: false,
          backgroundStyle: {
            color: 'rgba(180, 180, 180, 0.2)'
          }
        },
        {
          // data: [68, 77, 13, 44, 16, 79],
          type: 'bar',
          barWidth: '25%',
          itemStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              {
                offset: 0,
                color: '#BFFEFF'
              },
              {
                offset: 0.5,
                color: '#00FFAA'
              },
              {
                offset: 1,
                color: '#00FFAA'
              }
            ])
          },
          showBackground: false,
          backgroundStyle: {
            color: 'rgba(180, 180, 180, 0.2)'
          }
        }
      ]
    })
  }
  mounted() {
    this.initVillage4()
  }
}
</script>
<style lang="scss" scoped>
@import '~@/styles/cockpit.scss';
.bb-bg {
  width: 100%;
  height: 100%;
  padding: 12px 12px 12px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  &::before {
    content: '';
    display: block;
    width: 20px;
    height: 103%;
    background: url('~@/assets/cockpit/bpl-bg-line.png') no-repeat 0/ 100% 100%;
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translate(0, -50%);
  }
}
.gdbh-title-right {
  display: flex;
  .right-text {
    font-size: 12px !important;
    color: #dffeff;
    margin-right: 16px;
    margin-top: 6px;
  }
}
.gdbh-selected {
  width: 120px !important;
  margin-right: 40px;
}
.time-area {
  display: flex;
  margin-top: 12px;
  color: #fff;
  line-height: 29px;
  .name-style {
    font-size: 12px !important;
  }
  .mid-text-style {
    font-size: 12px !important;
    margin-right: 14px;
  }
  ::v-deep .el-input__inner {
    width: 100%;
  }
  .time-selected {
    width: 100px !important;
    margin-right: 16px;
  }
}

.td-list2 {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  li {
    flex: 1;
    .item {
      width: 84px;
      height: 84px;
      position: relative;
      margin: auto;
      img {
        width: 100%;
      }
      .name {
        position: absolute;
        top: 84px;
        left: -25%;
        width: 150%;
        text-align: center;
        font-size: 12px !important;
        text-align: center;
        color: #dffeff;
        line-height: 16px;
      }
      .text-area {
        position: absolute;
        top: 47px;
        left: 0;
        width: 100%;
        text-align: center;

        .num {
          font-weight: bold;
          font-size: 16px !important;
          color: #fff;
        }
        .num-style-1 {
          text-shadow: 0 0 8px #0fa;
        }
        .num-style-2 {
          text-shadow: 0 0 8px #f00;
        }
        .text {
          font-size: 12px !important;
          text-align: center;
          color: #dffeff;
          text-shadow: 0 0 6px #00eaff;
        }
      }
    }
  }
}

.row-line {
  width: 98%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 24px auto 0 auto;
}

.bpl-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  overflow: hidden;
  .col-line {
    flex-shrink: 0;
    width: 1px;
    height: 124px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1px 10px 0 10px;
    flex-shrink: 0;
  }
  .lf {
    flex: 3;
    .gdbh-total-statistics {
      width: 100%;
      display: flex;
      justify-content: space-between;
      .gdbh-total-area {
        li {
          margin-top: 14px;
          .text {
            font-size: 12px !important;
            color: #bffeff;
          }
          .num {
            font-size: 20px !important;
            line-height: 24px;
            color: #fff;
          }
        }
      }
    }
    .name-area {
      display: flex;
      margin-top: 6px;
      margin-left: 42px;

      .item {
        display: flex;
        margin-right: 24px;
        .icon {
          width: 6px;
          height: 6px;
          margin-top: 4px;
          transform: rotate(45deg);
          -ms-transform: rotate(45deg); /* IE 9 */
          -moz-transform: rotate(45deg); /* Firefox */
          -webkit-transform: rotate(45deg); /* Safari 和 Chrome */
          -o-transform: rotate(45deg); /* Opera */
        }
        .icon1 {
          background: linear-gradient(180deg, #3dc8fc 0%, #1c96ef 50%, #245abf 100%);
          filter: drop-shadow(0 0 4px #006aff);
        }
        .icon2 {
          background: linear-gradient(180deg, #2effaf 0%, #0fa 50%, #21c18b 100%);
          filter: drop-shadow(0 0 4px #6dffd6);
        }
        .icon3 {
          background: linear-gradient(180deg, #ffeb7b 0%, #ecbf45 50%, #ab9700 100%);
        }
        .text {
          font-size: 12px !important;
          color: #dffeff;
          margin-left: 8px;
        }
      }
    }
    .title {
      font-size: 12px !important;
      color: #dffeff;
    }
    .pq-echart-box {
      width: 193px;
      height: 78px;
      margin-top: 12px;
    }
  }
  .rg {
    flex: 5;
    .title {
      font-size: 12px !important;
      color: #dffeff;
    }
    .list-area {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      .item {
        display: flex;
        margin-top: 14px;
        width: 50%;
        .icon {
          width: 4px;
          height: 4px;
          margin-top: 4px;
          margin-right: 6px;
          display: block;
          background: #f9f0d4;
          border-radius: 1px;
          box-shadow: 0 0 4px 1px #f0b04a;
          transform: rotate(45deg);
        }
        .text-area {
          .text {
            font-size: 12px !important;
            color: #bffeff;
          }
          .num {
            color: #fff;
            font-size: 20px !important;
            line-height: 26px;
          }
        }
      }
    }
  }
}
</style>
